package com.lifa.controller;


import com.lifa.dao.XiaoFeiTableDao;
import com.lifa.entity.XiaoFeiTable;
import org.omg.CORBA.Request;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.xml.ws.Response;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/XiaoFeiTable")
@Scope("prototype")
public class XiaoFeiTabController {
    @Autowired
    private XiaoFeiTableDao xiaoFeiTabDao;


    @RequestMapping("/danju")
    @ResponseBody
    public Map<String,Object> danjutable(@RequestParam(value="id", defaultValue="0")int id, int offset, int limit){
        Map<String,Object> map = new HashMap<String, Object>();

        //System.out.print(id);
        map.put("rows",xiaoFeiTabDao.query(id,offset,limit));
        map.put("total",xiaoFeiTabDao.getTotalCount(id));
        return map;
    }

    @RequestMapping("/danjuhaoselect")
    @ResponseBody
    public List<XiaoFeiTable> danjuhaochaxun(String danhao){
        return xiaoFeiTabDao.listDanhao(danhao);
    }



}
